item_path:=$(shell pwd)

item_lib_path:=$(item_path)/lib/

item_main_path:=$(item_path)/main/

libpro:=libpro.so

pro=pro

item_h:=$(wildcard *.h)

srcs:=$(wildcard *.c)

srcs_main:=$(wildcard $(item_main_path)*.c)

objs:=$(srcs:%.c=%.o)

all : $(objs)
	gcc -shared -o $(item_lib_path)$(libpro) $^	
	mv $(item_h)  $(item_lib_path)
	rm -rf $^
	export LD_LIBRARY_PATH=$(item_lib_path)$(libpro)
	gcc $(srcs_main) -I $(item_lib_path) -L $(item_lib_path) -l$(pro)

$(objs) : %.o : %.c
	gcc  -fPIC -c $< -o $@

clear:
	rm -rf $(item_lib_path)$(pro)
	rm -rf a.out
